package com.glsc.ngateway.common.base.converter.oaflow;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.oaflow.xirtrade.TOaFlowXirTradeConfigUserRelated;
import com.glsc.ngateway.common.base.domainmapper.TOaFlowXirTradeConfigUserRelatedMapper;
import com.glsc.ngateway.common.api.oaflow.dto.xirtrade.TOaFlowXirTradeConfigUserRelatedDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class TOaFlowXirTradeConfigUserRelatedConverter {
    public static TOaFlowXirTradeConfigUserRelatedDto do2Dto(TOaFlowXirTradeConfigUserRelated domain) {
        if (Objects.isNull(domain)) {
            return null;
        }
        TOaFlowXirTradeConfigUserRelatedDto dto = TOaFlowXirTradeConfigUserRelatedMapper.INSTANCE.domain2dto(domain);
        return dto;
    }

    public static List<TOaFlowXirTradeConfigUserRelatedDto> do2Dto(List<TOaFlowXirTradeConfigUserRelated> domainList) {
        return CollectionUtils.isEmpty(domainList) ? java.util.Collections.emptyList() : domainList.stream().map(TOaFlowXirTradeConfigUserRelatedConverter::do2Dto).collect(Collectors.toList());
    }

    public static TOaFlowXirTradeConfigUserRelated dto2Do(TOaFlowXirTradeConfigUserRelatedDto dto) {
        if (Objects.isNull(dto)) {
            return null;
        }
        TOaFlowXirTradeConfigUserRelated domain = TOaFlowXirTradeConfigUserRelatedMapper.INSTANCE.dto2domain(dto);
        return domain;
    }

    public static List<TOaFlowXirTradeConfigUserRelated> dto2Do(List<TOaFlowXirTradeConfigUserRelatedDto> dtoList) {
        return CollectionUtils.isEmpty(dtoList) ? java.util.Collections.emptyList() : dtoList.stream().map(TOaFlowXirTradeConfigUserRelatedConverter::dto2Do).collect(Collectors.toList());
    }
}
